@ layout("/admin/_layout.html"){
    <!-- Docs page layout -->
    <div class="bs-header" id="content">
      <div class="container">
        <h1>最新话题列表</h1>
        <p>最新话题列表</p>
        
      </div>
    </div>

    <div class="container bs-docs-container">
      <p></p>
      <div class="row">
        <div class="col-md-9" role="main">
	        <div class="panel panel-default">
	        <table class="table table-hover table-striped">
	        	<thead><tr><th>时间</th><th>作者</th><th>标题</th><th>操作</th></tr></thead>
	        	<tbody>
	        	@ for(topic in topicPage.list!){
	              <tr>
	                <td>${printTime(topic.createTime)}</td>
	                <td><a href="/user/${topic.user.id}">${topic.user.username}</a></td>
	                <td><a id="c${topic.id}" href="/topic/${topic.id}" target="_blank">${topic.content}</a></td>
                    <td class="span2">
                        <a onclick="javascript:mEdit(${topic.id}, ${topic.moduleID})" href="#" title="编辑"><span class="glyphicon glyphicon-edit"></span></a>
                        <a href="/topic/delete/${topic.id}-${topicPage.pageNumber}" title="删除" onclick="return confirm('确定删除？')"><span class="glyphicon glyphicon-trash"></span></a>
                    </td>
	              </tr>
	            @ }
	            </tbody>
	        </table>
	        </div>
          <div class="centered">
		    @ include("/common/_paginate.html",
		    @ {"currentPage":topicPage.pageNumber,"totalPage":topicPage.totalPage,"actionUrl":"/admin/topicList/"}) {}
		  </div>
        </div>
        <div class="col-md-3">
          <div class="bs-sidebar hidden-print" role="complementary">
            <ul class="nav bs-sidenav">
              
                <li>
	            <form action="/topic/update" method="post" role="form" class="form-horizontal">
	                <div class="centered"><h2>修改</h2></div>
					<input type="hidden" id="tid" name="topic.id" value="${topic.id!}">
					<div class="input-group">
					  <span class="input-group-addon span1">标题：</span>
					  <input type="text" name="topic.content" id="tcontent" value="${topic.content!}" class="form-control" placeholder="输入标题">
					</div>
					<div class="input-group">
					  <span class="input-group-addon span1">类别：</span>
					  <select name="topic.moduleID" class="selectpicker form-control" id="tmodule">
				        @ for(vv in moduleList!){
				        <option value="${vv.id}" moduleID="${vv.id}" ${isSame(vv.id!, topic.moduleID!, "selected='selected'")}>
				        ${vv.name}
				        </option>
				        @ }
				    </select>
					</div>
					<div class="centered"><button class="btn btn-primary" type="submit">保存</button></div>
	            </form>
	        	</li>
	        </ul>
          </div>
        </div>
      </div>
    </div>
@ }
<script type="text/javascript">
	function mEdit(tid, mid){
		$("#tid").val(tid);
		$("#tcontent").val($("#c" + tid).text());
		$("#tmodule").selectpicker('val', mid);
	}
</script>
